name: 'Build test'

on:
  push:
  pull_request:
    types:
      - reopened
      - ready_for_review
    branches:
      - main
      - develop
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Install dependencies
        run: |
          sudo apt update
          sudo apt install -y cmake graphviz
          sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
          sudo apt install -y g++-13 gcc-13

      - uses: actions/checkout@v4

      - name: Configure
        env:
          CC: gcc-13
          CXX: g++-13
        run: cmake -S . -B build

      - name: Build
        run: cd build && cmake --build .

      - name: Unit tests
        run: cd build && ctest
